﻿using System;
using System.Net;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SoftwareApproach.TestingExtensions;

namespace ProxyFinder.Tests {
    [TestClass]
    public class DefaultCredentialProviderTests {
        
        [TestMethod]
        public void DefaultCredentialProvider_Create() {
            ICredentialProvider provider = new DefaultCredentialProvider();
            provider.ShouldNotBeNull();
        }

        [TestMethod]
        public void DefaultCredentialProvider_GetCredentials_ShouldThrowException_OnNullUri() {
            var provider = new DefaultCredentialProvider();
            Testing.ShouldThrowException<ArgumentNullException>(() => provider.GetCredentials(null));
        }
        [TestMethod]
        public void DefaultCredentialProvider_GetCredentials_ShouldReturnEmptyList() {
            var provider = new DefaultCredentialProvider();
            provider.GetCredentials(Constants.TARGET_KEY).ShouldBeEmpty();
        }

        [TestMethod]
        public void DefaultCredentialProvider_DefaultCredentials_ShouldReturn_DefaultCredentials() {
            ICredentialProvider provider = new DefaultCredentialProvider();
            provider.DefaultCredentials.ShouldEqual(CredentialCache.DefaultCredentials);
        }

    }
}
